package com.course.mapper;

import com.course.entity.Role;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;

/**
 * <p>
 * 后台用户角色表 Mapper 接口
 * </p>
 *
 * @author author
 * @since 2022-09-16
 */
public interface RoleMapper extends BaseMapper<Role> {

    @Insert("INSERT INTO role_permission (`role_id`,`permission_id`) VALUES (#{role_id},#{permission_id})")
    Boolean linkPermission(Long role_id,Long permission_id);

    @Delete("DELETE FROM role_permission WHERE role_id in (0, #{values});")
    Boolean unLinkPermission(String values);
}
